Page({

    // 加载
    onLoad() {
        // 设备信息
        wx.getSystemInfo({
            success: (result)=>{
                console.log(result)
            },
            fail: ()=>{},
            complete: ()=>{}
        })

        // 判断小程序API，方法回调是否可用
        console.log(wx.canIUse('console')) 
        console.log(wx.canIUse('console.log')) 
        console.log(wx.canIUse('getSystemInfo')) 
        console.log(wx.canIUse('getSystemInfo.success')) 

        // 获取当前的网络
        wx.getNetworkType({
            success: (result)=>{
                console.log(result)
            },
            fail: ()=>{},
            complete: ()=>{}
        })

        // 扫描码
        wx.scanCode({
            onlyFromCamera: false,
            scanType: ['qrCode','barCode','datamatrix','pdf417'],
            success: (result)=>{
                console.log(result)
            },
            fail: ()=>{
                console.log('失败')
            },
            complete: ()=>{}
        })
    }

})